package com.rm.zeyou.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.github.pagehelper.PageInfo;
import com.rm.zeyou.entity.User;
import com.rm.zeyou.response.ApiRestResponse;
import com.rm.zeyou.service.ClockItemService;
import com.rm.zeyou.util.login.LoginUtil;
import com.rm.zeyou.vo.request.SelectBellItemListVo;
import com.rm.zeyou.vo.request.SelectItemListVo;
import com.rm.zeyou.vo.response.SelectItemDetailResponseVo;
import com.rm.zeyou.vo.response.SelectUserCollectionListResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 加钟服务项目表 前端控制器
 * </p>
 *
 * @author YanYang
 * @since 2025-03-12 15:55:07
 */
@Api(tags = "加钟项目相关")
@RestController
@RequestMapping("/api/clockItem")
public class ClockItemController {
    @Resource
    private ClockItemService clockItemService;
    @Resource
    private LoginUtil loginUtil;

    @ApiOperation(value = "查询加钟项目")
    @PostMapping("selectBellItemList")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<PageInfo<SelectUserCollectionListResponseVo>> selectBellItemList(@RequestBody SelectBellItemListVo selectBellItemListVo) {
        User user = loginUtil.getUser();
        return clockItemService.selectBellItemList(user.getId(),selectBellItemListVo);
    }

    @ApiOperation(value = "查询加钟服务项目详情")
    @PostMapping("selectBellItemDetail")
    @SaCheckLogin(type = "user")
    public ApiRestResponse<SelectItemDetailResponseVo> selectBellItemDetail(@RequestBody SelectItemListVo selectVo) {
        User user = loginUtil.getUser();
        return clockItemService.selectBellItemDetail(user.getId(),selectVo);
    }

}
